package org.u2ml.app.domain;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

@Entity
@XStreamAlias("attribute")
public class Attribute extends ResponseData {
	@XStreamAsAttribute
	transient private Long oid;
	
	@XStreamAsAttribute
	private String name;
	
	@XStreamAsAttribute
	private Long classId;
	
	transient private ProjectClass parent;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Long getOid() {
		return oid;
	}
	
	public void setOid(Long oid) {
		this.oid = oid;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public Long getClassId() {
		return classId;
	}

	public void setClassId(Long classId) {
		this.classId = classId;
	}
	
	@ManyToOne
	@JoinColumn(name="class_id")
	public ProjectClass getParent() {
		return parent;
	}

	public void setParent(ProjectClass parent) {
		this.parent = parent;
	}
}
